import Vue from "vue"
import Vuex from "vuex"
Vue.use(Vuex);

const store = new Vuex.Store({
    state: {//初始化数据
        token: '',
        username: ''
    },
    getters: {
        getToken: state => {return state.token},
        getUsername: state => {return state.username}
    },
    mutations: {
        setToken(state, token) {
            state.token = token
        },
        setUsername(state, username) {
            state.token = username
        },
    }
})

export default store
